﻿/// <reference path="../../jquery-1.8.2.min.js" />
/// <reference path="../../qunit.js" />
/// <reference path="Details.js" />

module('burn down chart', {
  setup: function () {
    // trick
    this.body = $('body'); // which is the test runner's body
    this.body.append('<canvas id="chart" width="1100" height="600">[FIXTURE]</canvas>');
    // /trick

    // data
    var labels = ('15/10,16/10,17/10,18/10,19/10,22/10,23/10,24/10,25/10,26/10').split(',');
    var storyPoints = ('33,33,30,29').split(',');
    // /data

    var canvas = $('#chart', this.body);
    var globalOffset = 50;
    this.manager = new BurnDownManager(canvas, globalOffset, labels, storyPoints);
  }
});

test('draw grid x', function () {
  ok(this.manager.drawGridLineX(), 'drawGridLineX has been called');
});

test('draw grid y', function () {
  ok(this.manager.drawGridLineY(), 'drawGridLineY has been called');
});

test('draw axis', function () {
  ok(this.manager.drawAxis(), 'drawAxis has been called');
});

test('draw marks x', function () {
  ok(this.manager.drawMarksX(), 'drawMarksX has been called');
});

test('draw labels x', function () {
  ok(this.manager.drawLabelX(), 'drawLabelX has been called');
});

test('draw marks y', function () {
  ok(this.manager.drawMarksY(), 'drawMarksY has been called');
});

test('draw labels y', function () {
  ok(this.manager.drawLabelY(), 'drawLabelY has been called');
});

test('draw ideal', function () {
  ok(this.manager.drawIdeal(), 'drawIdeal has been called');
});

test('draw segments', function () {
  ok(this.manager.drawSegments(), 'drawSegments has been called');
});

test('draw segments labels', function () {
  ok(this.manager.drawSegmentsLabels(), 'drawSegmentsLabels has been called');
});

test('get full scale', function () {
  equal(this.manager.getFullScale(40), 45, 'in 40 out 45');
});

test('get full scale', function () {
  equal(this.manager.getFullScale(44), 45, 'in 44 out 54');
});

test('get full scale', function () {
  equal(this.manager.getFullScale(45), 54, 'in 45 out 54');
});
